package mspbots.cw.business.core.sysuser;

import org.springframework.data.r2dbc.repository.Query;
import org.springframework.data.r2dbc.repository.R2dbcRepository;
import reactor.core.publisher.Mono;

/**
 * @author Jay.Yang
 */
public interface SysUserRepository extends R2dbcRepository<SysUser, Long> {
    /**
     * find entity other id and tenant id
     *
     * @param email      email
     * @param tenantCode tenantCode
     * @return account entity
     */
    @Query("select * from sys_user where tenant_code=:tenantCode and lower(email)=:email limit 1")
    Mono<SysUser> findByEmailAndTenantCode(String email, Long tenantCode);
}
